package com.gitee.wsl.ext.number



fun Float.mix(b: Float, interp: Float) = _mix(this, b, interp)
fun Double.mix(b: Double, interp: Double) = _mix(this, b, interp)

fun Float.mix(b: Float, interp: Boolean) = _mix(this, b, interp)
fun Double.mix(b: Double, interp: Boolean) = _mix(this, b, interp)

internal fun _mix(a: Float, b: Float, interp: Float) = a + interp * (b - a)
internal fun _mix(a: Double, b: Double, interp: Double) = a + interp * (b - a)

internal fun _mix(a: Float, b: Float, interp: Boolean) = if (interp) b else a
internal fun _mix(a: Double, b: Double, interp: Boolean) = if (interp) b else a